package com.coin.config;

import cn.hutool.core.lang.Snowflake;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.*;

/**
 * @Auther: 李 力
 * @Date: 2025/6/13
 * @Description: com.coin.config
 * @version: 1.0
 */
@Configuration
public class IdConfig {

    @Value("${snow.app.id:1}")
    private Integer appId;

    @Value("${snow.data.id:1}")
    private Integer dataId;

    /**
     * 雪花算法
     *
     * @return
     */
    @Bean
    public Snowflake snowflake() {
        Snowflake snowflake = new Snowflake(appId, dataId);
        return snowflake;
    }
}
